var app = getApp();
var util= require("../../utils/libs.js");
var api = require("../../utils/api.js");
var date = require("../../utils/date.js")
Page({
  data: {
     skillList:[],
     id:"",
     uid:"",
     page:0,
     limit:10
  },
  onLoad () {
    let that = this
    that.buildList()
    // 页面初始化 options为页面跳转所带来的参数
  },
  buildList(){
    let that = this
    util.request(api.buildList,{
      page:that.data.page,
      limit:that.data.limit
    },"GET")
    .then(function (res) {
      if(res.error_code === 0){
         let arr = res.data.list
         console.log(res)
          arr.forEach(value => {
            value.create_time= date.data(value.create_time)
            value.content=value.content.substring(0,40)+'……'
          });
        that.setData({
          skillList:arr
        })
      }
    })
  },
  toDetail(e){
     let id = e.currentTarget.dataset.id
     wx.navigateTo({
       url:"/pages/listdetais/listdetais?id="+id
     })
  }
})
